﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using CERT.Services.DAL;
using CERT.Services;
using System.Web.Mvc;


namespace CERT.Controllers
{
    public class IncidentController : ApiController
    {
       private INETServices Service;


       public IncidentController()
       {
           Service = new NETServices();

       }

       public IncidentController(INETServices service)
        {
            Service = service;

        }

        // GET api/Incident
       [ValidateAntiForgeryToken]
       [System.Web.Mvc.Authorize]
        public IEnumerable<Incident> GetIncidents()
        {
            try
            {
                return Service.GetAllIncidents();
            }
            catch (Exception ex)
            {
                throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
            }
        }

      
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);
        }
    }
}